package com.futures.questionbank.my;

import android.content.Intent;
import android.view.View;
import android.widget.TextView;

import com.futures.questionbank.R;
import com.futures.questionbank.Utils.UItils;
import com.futures.questionbank.base.BaseActivity;
import com.futures.questionbank.main.LoginActivity;
import com.futures.questionbank.view.CommonDialog;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * author : huang
 * date   : 2020/6/16 0016 11:18
 * version: 1.0
 */
public class SettingActivity extends BaseActivity {
    @BindView(R.id.tv_change_password)
    TextView tvChangePassword;
    @BindView(R.id.tv_clear)
    TextView tvClear;
    @BindView(R.id.tv_update)
    TextView tvUpdate;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.setting_activity);
        setTitle("设置");
    }

    @Override
    protected void loadData() {

    }



    @OnClick({R.id.tv_change_password, R.id.tv_clear, R.id.tv_update,R.id.sb_out})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_change_password:
                startActivity(new Intent(SettingActivity.this,ChangePassWordActivity.class));
                break;
            case R.id.tv_clear:
                String s2 = "确定清除缓存吗?";
                new CommonDialog(this, R.style.dialog, s2, (dialog, confirm) -> {
                    if (confirm) {
                        UItils.showToastSafe("清除缓存完成");
                    }
                    dialog.dismiss();
                }).show();
                break;
            case R.id.tv_update:
                break;
            case R.id.sb_out:
                String s = "确定退出吗?";
                new CommonDialog(this, R.style.dialog, s, (dialog, confirm) -> {
                    if (confirm) {
                        Intent intent2 = new Intent(this, LoginActivity.class);
                        intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);
                        startActivity(intent2);
                    }
                    dialog.dismiss();
                }).show();
                break;
            default:
        }
    }
}
